FrameLib  2.0
DSP processing with frames of arbitrary timing and length
FrameLib_Export.h
Go to the documentation of this file.
1 
2 static char exportHeader[] = "\n\
3 #include \"FrameLib_Multistream.h\"\n\
4 #include <vector>\n\n\
5 class $\n\
6 {\n\n\
7 public:\n\n\
8  $(FrameLib_Proxy *proxy = new FrameLib_Proxy());\n\
9  ~$();\n\n\
10  void reset(double samplerate, unsigned long maxvectorsize);\n\
11  void process(double **inputs, double **output, unsigned long blockSize);\n\n\
12  unsigned long getNumAudioIns() const { return mNumAudioIns; }\n\
13  unsigned long getNumAudioOuts() const { return mNumAudioOuts; }\n\n\
14 private:\n\n\
15  FrameLib_Global *mGlobal;\n\
16  std::vector<FrameLib_Multistream *> mObjects;\n\
17  std::vector<FrameLib_Multistream *> mAudioObjects;\n\
18  unsigned long mNumAudioIns;\n\
19  unsigned long mNumAudioOuts;\n\
20  FrameLib_Proxy *mProxy;\n\
21 };";
22 
23 static char exportCPPOpen[] = "\n\
24 #include \"$.h\"\n\
25 #include \"FrameLib_Objects.h\"\n\n\
26 $::$(FrameLib_Proxy *proxy) : mNumAudioIns(0), mNumAudioOuts(0), mProxy(proxy)\n\
27 {\n\
28  using Connection = FrameLib_Object<FrameLib_Multistream>::Connection;\n\n\
29  FrameLib_Global::get(&mGlobal);\n\
30  FrameLib_Context context(mGlobal, this);\n\
31  FrameLib_Parameters::AutoSerial parameters;\n\n";
32 
33 static char exportCPPClose[] = "\
34  for (auto it = mObjects.begin(); it != mObjects.end(); it++)\n\
35  {\n\
36  if ((*it)->getType() == kScheduler || (*it)->getNumAudioChans())//if ((*it)->handlesAudio())\n\
37  mAudioObjects.push_back(*it);\n\n\
38  mNumAudioIns += (*it)->getNumAudioIns();\n\
39  mNumAudioOuts += (*it)->getNumAudioOuts();\n\
40  }\n\
41 }\n\n\
42 $::~$()\n\
43 {\n\
44  for (auto it = mObjects.begin(); it != mObjects.end(); it++)\n\
45  delete *it;\n\n\
46  mObjects.clear();\n\
47  mAudioObjects.clear();\n\
48  delete mProxy;\n\
49  FrameLib_Global::release(&mGlobal);\n\
50 }\n\n\
51 void $::reset(double samplerate, unsigned long maxvectorsize)\n\
52 {\n\
53  for (auto it = mObjects.begin(); it != mObjects.end(); it++)\n\
54  (*it)->reset(samplerate, maxvectorsize);\n\
55 }\n\n\
56 void $::process(double **inputs, double **outputs, unsigned long blockSize)\n\
57 {\n\
58  for (auto it = mAudioObjects.begin(); it != mAudioObjects.end(); it++)\n\
59  {\n\
60  (*it)->blockUpdate(inputs, outputs, blockSize);\n\n\
61  inputs += (*it)->getNumAudioIns();\n\
62  outputs += (*it)->getNumAudioOuts();\n\
63  }\n\
64 }";
65 
66 static char exportIndent[] = " ";